

package com.idcos.enterprise.portal.dal.repository;

// auto generated imports

import com.idcos.cloud.core.dal.common.jpa.BaseRepository;
import com.idcos.enterprise.portal.dal.entity.PortalGroupUserRel;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 自动生成PortalGroupUserRelRepository
 * <p>
 * 数据库配置文件自动生成,此文件属于自动生成的,具体可以参考codegen工程
 * Generated by <tt>jap-codgen</tt> on 2015-10-29 14:50:33.
 *
 * @author system-user
 * @version PortalGroupUserRelRepository.java, v 1.1 2015-10-29 14:50:33 system-user Exp $
 */
public interface PortalGroupUserRelRepository extends BaseRepository<PortalGroupUserRel, String> {

    /**
     * <p>
     * The jql statement for this operation is <br>
     *
     * @param userId
     * @return List<PortalGroupUserRel>
     */
    List<PortalGroupUserRel> findByUserId(String userId);

    /**
     * <p>
     * The jql statement for this operation is <br>
     * <tt>delete from PortalGroupUserRel t where t.groupId = ?1 and t.userId = ?2</tt>
     *
     * @param groupId
     * @param userId
     * @return int
     */
    @Query("delete from PortalGroupUserRel t where t.groupId = ?1 and t.userId = ?2")
    @Modifying
    int deleteByGroupIdAndUserId(String groupId, String userId);

    /**
     * 根据用户id删除
     *
     * @param id
     * @return
     */
    @Modifying
    @Query("delete from PortalGroupUserRel t where t.userId = ?1")
    int deleteByUserId(String id);

    /**
     * <p>
     * The jql statement for this operation is <br>
     *
     * @param groupId
     * @return List<PortalGroupUserRel>
     */
    List<PortalGroupUserRel> findByGroupId(String groupId);

}